﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Manage/Manage.Master" AutoEventWireup="true" CodeBehind="edit.aspx.cs" Inherits="web.Manage.Product.edit" ValidateRequest="false" %>

<%@ Import Namespace="PRO.Common" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        input[type="text"] { width: 700px; }
        input[type="file"] { width: 445px; }
        textarea { width: 700px; height: 60px; }
        .frm_tab { border-bottom: 1px #eee solid; border-right: 1px #eee solid; }
        .frm_tab td { border-top: 1px #eee solid; border-left: 1px #eee solid; }
        .frm_tab td select { min-width: 100px; }
        .frm_tab td .icon { max-width: 300px; }
        .frm_tab .right { background: #f8f8f8; width: 80px; font-weight: bold; }
    </style>
    <script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.all.js"></script>
    <link rel="stylesheet" type="text/css" href="/ueditor/themes/default/css/ueditor.css" />

    <script type="text/javascript">
        function checksubmit() {
            if ($(".drpclass").val() == "0") {
                alert("请选择产品分类！");
                return false;
            }
            if ($(".txttitle").val().replace(/\s+/g, "") == "") {
                alert("请输入产品名称！");
                return false;
            }
            if ($(".txtprice").val().replace(/\s+/g, "") == "") {
                alert("请输入产品价格！");
                return false;
            }
            else {
                var reg = /^(-?\d+)(\.\d{1,2})?$/
                if (!reg.test($(".txtprice").val())) {
                    alert("产品价格格式不正确！");
                    return false;
                }
            }

            if ($("#txtContents").val().replace(/\s+/g, "") == "") {
                alert("请输入产品详细介绍！");
                return false;
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder_PageInfo" runat="server">
    添加产品
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder_Menus" runat="server">
    <li><a href="default.aspx?id=<%=cid %>">查看产品列表</a></li>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder_Content" runat="server">
    <form runat="server">
        <%if (!error)
          { %>
        <table class="frm_tab" cellpadding="0" cellspacing="0">
            <tr>
                <td class="right">所属分类：</td>
                <td colspan="3">
                    <asp:DropDownList ID="drpClass" CssClass="drpclass" runat="server"></asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="right">产品标题：</td>
                <td colspan="3">
                    <asp:TextBox ID="txtTitle" CssClass="txttitle" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="right">是否上架：</td>
                <td colspan="3">
                    <asp:CheckBox ID="chb_show" Checked="true" runat="server" />

                </td>
            </tr>
            <tr>
                <td class="right">产品价格：</td>
                <td>
                    <asp:TextBox ID="txtPrice" Width="60px" CssClass="txtprice" Style="text-align: center;" runat="server"></asp:TextBox>
                    元    <font>（价格示例：39.98）</font>
                </td>

                <%--<td class="right">排序序号：</td>
                <td style="width: 60px;">
                    <asp:TextBox ID="txtSort" Width="60px" Text="0" runat="server" Style="text-align: center;"></asp:TextBox>
                </td>--%>
            </tr>
            <tr>
                <td class="right" rowspan="2">产品头图：</td>
                <td colspan="3">
                    <%if (id > 0 && productinfo.ID > 0 && !productinfo.Icon.IsNullOrWhiteSpace())
                      { %>
                    <img src="<%=productinfo.Icon %>" class="icon" />
                    <% }%>
                </td>
            </tr>
            <tr>
                <td colspan="3" style="border-top: none;">
                    <asp:FileUpload ID="FileUpload_Icon" runat="server" /></td>
            </tr>
            <tr>
                <td class="right">产品简介：</td>
                <td colspan="3">
                    <asp:TextBox ID="txtDes" TextMode="MultiLine" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td class="right">产品介绍：</td>
                <td colspan="3">
                    <script type="text/plain" id="render_Contents"><%=Contents %></script>
                    <textarea id="txtContents" name="txtContents" rows="14" style="display: none;"
                        cols="200"><%=Contents %></textarea>
                    <script type="text/javascript">
                        var ue_Description = new UE.ui.Editor();
                        ue_Description.render('render_Contents');
                        ue_Description.addListener("selectionchange", function () {
                            document.getElementById("txtContents").value = ue_Description.getContent();
                        });
                    </script>
                </td>
            </tr>
        </table>
        <div class="foot_bar">
            <asp:Button ID="Button1" OnClientClick="return checksubmit();" runat="server" Text="保存" OnClick="Button1_Click" />
        </div>
        <%}
          else
          { %>
        <cenert>参数不正确</cenert>
        <%} %>
    </form>

</asp:Content>
